using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;

public class LitMenu_CDN
{
    [MenuItem("LitMenu/CDN/Start")]
    public static void StartCDNService()
    {
#if UNITY_EDITOR_OSX
        Debug.LogWarning("Mac系统中请在Finder中用终端执行【sh server_sh.sh】启动cdn服务");
        return;
#endif
        string path = $"../CDN/";
        path = Path.Combine(Application.dataPath, path);
        string batPath = $"server_cdn.bat";
        Process proc = new();
        proc.StartInfo.FileName = batPath;
        proc.StartInfo.WorkingDirectory = path;
        proc.Start();
    }

    [MenuItem("LitMenu/CDN/OpenFolder")]
    public static void OpenCDNPath()
    {
        string path = $"../CDN/Res/";
        path = Path.Combine(Application.dataPath, path);
        Process.Start(new ProcessStartInfo() { FileName = path });
    }

    [MenuItem("LitMenu/CDN/OpenBrowser")]
    public static void OpenCDNBrowser()
    {
        Application.OpenURL(ProjectConfig.Config.cdn);
    }
}